package R.Service;

import R.Dao.RegDao;
import R.Entity.Record;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "DelRegServlet", value = "/RegDelServlet")
public class RegDelServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        //获取传递参数
        String RegistrationID=request.getParameter("RegistrationID");
        Record r=new Record();
        r.setRegistrationID(RegistrationID);
        int sta= RegDao.delR(r);
        if (sta>0){
            response.sendRedirect("/RegShowAll");
        }else {
            response.sendRedirect("/RegShowAll");
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
